diff options
| author | Adam Soltys <[email protected]> | 2023-01-18 19:44:27 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-18 19:44:27 -0800 |
| commit | 0e0f39af2e6585d7b61cf67652cdc0c2b2f06eb8 (patch) | |
| tree | 85e0fb00f3aa89fdde1cbb667bf801564bff7610 /src/routes/(app)/invoice/[id]/+layout.server.js | |
| parent | 7de4b0d2cd330674dcd02d2b007c1477fd48caaa (diff) | |
| download | coinos-ui-0e0f39af2e6585d7b61cf67652cdc0c2b2f06eb8.tar.gz coinos-ui-0e0f39af2e6585d7b61cf67652cdc0c2b2f06eb8.zip | |
pots
Diffstat (limited to 'src/routes/(app)/invoice/[id]/+layout.server.js')
| -rw-r--r-- | src/routes/(app)/invoice/[id]/+layout.server.js | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.js b/src/routes/(app)/invoice/[id]/+layout.server.js deleted file mode 100644 index 78d8481e..00000000 --- a/src/routes/(app)/invoice/[id]/+layout.server.js +++ /dev/null @@ -1,19 +0,0 @@ -import Qr from 'qrcode-base64'; -import { get } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ depends, params, url }) { - depends('app:invoice'); - - let { id } = params; - let invoice = await get(`/invoice?id=${id}`); - let { amount, received } = invoice; - amount = parseInt(amount); - - let paid = (!amount && received) || (amount > 0 && received >= amount); - if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/invoice/${id}/paid`); - - let sm = Qr.drawImg(invoice.text, { size: 300 }); - - return { id, invoice, sm, lg: sm }; -} |
